﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Compiler
{
    public static class CompilerFactory
    {
        public static Compiler.ICompiler GetCompiler(CompileType compileType, string language)
        {
            Compiler.ICompiler compiler = null;
            if (language == "VisualBasic")
            {
                switch (compileType)
                {
                    case CompileType.Fragment:
                        compiler = new Compiler.VisualBasic.VisualBasicFragmentCompiler();
                        break;
                    case CompileType.Method:
                        compiler = new Compiler.VisualBasic.VisualBasicMethodCompiler();
                        break;
                    case CompileType.Class:
                        compiler = new Compiler.VisualBasic.VisualBasicClassCompiler();
                        break;
                }
            }
            else if (language == "CSharp")
            {
                switch (compileType)
                {
                    case CompileType.Fragment:
                        compiler = new Compiler.CSharp.CSharpFragmentCompiler();
                        break;
                    case CompileType.Method:
                        compiler = new Compiler.CSharp.CSharpMethodCompiler();
                        break;
                    case CompileType.Class:
                        compiler = new Compiler.CSharp.CSharpClassCompiler();
                        break;
                }
            }

            return compiler;
        }
    }
}
